/**
 * Created by win7 on 2017/3/27.
 */

import Relay from "react-relay";

export default class UpdateRoleMutation extends Relay.Mutation {

    static fragments = {};

    getMutation() {
        return Relay.QL`mutation { updateRole }`;
    }

    getVariables() {
        return {
            argsInput: {
                pid: this.props.pid,
                name:this.props.name,
                description:this.props.description,
                rid:this.props.rid
            }
        };
    }

    getFatQuery() {
        return Relay.QL`fragment on updateRolePayload {
            updateRole {
                errorCode
                value
                totalResult
                id
                permissionList{
                    name
                    enName             
                }
                role{
                    rid
                    name
                    description
                    pid
                }
            }
        }`;
    }

    getConfigs() {
        return [{
            type: 'REQUIRED_CHILDREN',
            children: [Relay.QL`fragment on updateRolePayload {
                    updateRole {
                        errorCode
                        value
                        totalResult
                        id
                        permissionList{
                            name
                            enName                
                        }
                        role{
                            rid
                            name
                            description
                            pid
                        }
                    }
                }
            `]
        }];
    }

}